home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / CONVERTR / PARSEHTM / README.TXT < prev    next >
Encoding:
Text File  |  1995-09-18  |  2.6 KB  |  67 lines

  1. Cheap HTML parser
  2.  
  3. Jim Davis
  4.  
  5. davis@dri.cornell.edu
  6.  
  7. July 1994
  8.  
  9.  
  10.  
  11. This is code for doing simple processing on HTML. I know there are bugs and
  12.  
  13. limitations in the code, but it suffices for simple purposes. Among the
  14.  
  15. limitations: This is an HTML parser, not an SGML parser - it does not
  16.  
  17. accept a DTD, rather the model of HTML is built into the code. Also it does
  18.  
  19. not validate the HTML - it will attempt to parse invalid documents, and the
  20.  
  21. results are undefined if the document is in error.
  22.  
  23.  
  24.  
  25. The source code is available as a compressed Unix tar file. It runs under
  26.  
  27. perl 4.0 patch level 36. I don't know about other versions of perl. This
  28.  
  29. directory contains:
  30.  
  31.  
  32.  
  33. parse-html.pl
  34.  
  35.      A simple HTML parser written in perl. As it parses the HTML, it calls
  36.  
  37.      routines (which you may redefine) for each tag encountered, and for
  38.  
  39.      whitespace and content. You can redefine these routines so as to
  40.  
  41.      process the HTML document.
  42.  
  43. html-to-ascii.pl
  44.  
  45.      Uses the HTML parser to generate a plain ASCII version of an HTML
  46.  
  47.      document.
  48.  
  49. html-ascii.pl
  50.  
  51.      The actual routines to generate the ASCII.
  52.  
  53. tformat.pl
  54.  
  55.      A lowlevel text formatter used for generating ASCII. More or less like
  56.  
  57.      a subset of nroff
  58.  
  59. html-to-rfc.pl
  60.  
  61.      Uses the HTML parser to generate a plain ASCII version of an HTML,
  62.  
  63.      with special formatting requirements for Internet drafts and RFCs
  64.  
  65. rfc.pl
  66.  
  67.      Additional routines required for RFC formatting (e.g. page headers and
  68.  
  69.      footers)
  70.  
  71.  
  72.  
  73. Generating RFCs from HTML
  74.  
  75.  
  76.  
  77. The RFC format requires there be a header and footer containing, among
  78.  
  79. other things, the name of the authors, a short title, and so on. You
  80.  
  81. specify values for these fields with META tags as shown by the following
  82.  
  83. example.
  84.  
  85.  
  86.  
  87. <META name="status" content="Internet Draft">
  88.  
  89. <META name="title" content="Internet audio protocol">
  90.  
  91. <META name="date" content="July 1983">
  92.  
  93. <META name="author" content="Nixon, Haldeman">
  94.  
  95.  
  96.  
  97. (The META tag is not officially part of HTML, it was proposed by Roy
  98.  
  99. Fielding.) The tags should be in the HEAD.
  100.  
  101.  
  102.  
  103. Known bugs
  104.  
  105.  
  106.  
  107.    * It can't parse the prolog (or whatever you call it) because it does
  108.  
  109.      not know how to ensure that the square brackets match, e.g. the
  110.  
  111.      following
  112.  
  113.  
  114.  
  115.         <!DOCTYPE HTML [
  116.  
  117.           <!entity % HTML.Minimal "INCLUDE"<
  118.  
  119.           <!-- Include standard HTML DTD --<
  120.  
  121.           <!ENTITY % html PUBLIC "-//connolly hal.com//DTD WWW HTML 1.8//EN"<
  122.  
  123.           %html;
  124.  
  125.           ]<
  126.  
  127.  
  128.  
  129.    * font tags (e.g. CODE, EM) cause an extra whitespace in output e.g.
  130.  
  131.      <TT>foo</TT> yields "foo ,".
  132.  
  133.